﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/AdminSite.Master" AutoEventWireup="true" CodeBehind="quanlytaikhoan.aspx.cs" Inherits="WebRaoVat.Admin.QuanLyTaiKhoan" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<div id="blockright">
        <div id="box-pro-highlights-main">
                <div class="content">
                <div class="box-pro-highlights-main-header">
                            [Tài khoản] Quản lý loại tài khoản
            </div>
                    <asp:GridView ID="GridView2" runat="server" AllowPaging="True" 
                        AutoGenerateColumns="False" DataKeyNames="MaLoaiNguoiDung" 
                        DataSourceID="SqlDataSourceLoaiNguoiDung">
                        <Columns>
                            <asp:CommandField ShowEditButton="True" CancelText="Hủy" UpdateText="Cập nhật" EditText="Sửa" />
                            <asp:TemplateField HeaderText="MaLoaiNguoiDung" InsertVisible="False" 
                                SortExpression="MaLoaiNguoiDung">
                                <EditItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("MaLoaiNguoiDung") %>'></asp:Label>
                                </EditItemTemplate>
                                <HeaderTemplate>
                                    Mã loại
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("MaLoaiNguoiDung") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="TenLoaiNguoiDung" 
                                SortExpression="TenLoaiNguoiDung">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox1" runat="server" 
                                        Text='<%# Bind("TenLoaiNguoiDung") %>'></asp:TextBox>
                                </EditItemTemplate>
                                <HeaderTemplate>
                                    Tên loại
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("TenLoaiNguoiDung") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Deleted" SortExpression="Deleted">
                                <EditItemTemplate>
                                    <asp:DropDownList ID="DropDownList6" runat="server"
                                     DataValueField="Deleted"
                                    SelectedValue='<% # Bind("Deleted") %>'>
                                        <asp:ListItem>0</asp:ListItem>
                                        <asp:ListItem>1</asp:ListItem>
                                    </asp:DropDownList>
                                </EditItemTemplate>
                                <HeaderTemplate>
                                    Đã xóa
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <asp:DropDownList ID="DropDownList5" runat="server" DataValueField="Deleted"
                                SelectedValue='<% # Bind("Deleted") %>' Enabled="false">
                                        <asp:ListItem>0</asp:ListItem>
                                        <asp:ListItem>1</asp:ListItem>
                                    </asp:DropDownList>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                    <asp:SqlDataSource ID="SqlDataSourceLoaiNguoiDung" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:RAOVATConnectionString %>" 
                        SelectCommand="SELECT * FROM [LOAINGUOIDUNG]" 
                        UpdateCommand="UPDATE [LOAINGUOIDUNG] SET [TenLoaiNguoiDung] = @TenLoaiNguoiDung, [Deleted] = @Deleted WHERE [MaLoaiNguoiDung] = @MaLoaiNguoiDung">
                        <UpdateParameters>
                            <asp:Parameter Name="TenLoaiNguoiDung" Type="String" />
                            <asp:Parameter Name="Deleted" Type="Int32" />
                            <asp:Parameter Name="MaLoaiNguoiDung" Type="Int32" />
                        </UpdateParameters>
                    </asp:SqlDataSource>
                    
                    <div style="float:left">
                        <asp:Label ID="Label11" runat="server" Text="Thêm loại tài khoản"></asp:Label>
                    <asp:TextBox ID="txtLoaiNguoiDung" runat="server"></asp:TextBox>
                    <asp:Button ID="Button2" runat="server" Text="Đồng ý thêm" 
                    onclick="Button2_Click" />
                    </div>
            </div>
            </div>
          <div id="box-pro-highlights-main">
                <div class="content">
                <div class="box-pro-highlights-main-header">
                            Quản lý tài khoản
                        </div>
            <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" 
                AutoGenerateColumns="False" DataKeyNames="MaNguoiDung" 
                DataSourceID="SqlDataSource2" onrowupdating="GridView1_RowUpdating">
                <Columns>
                    <asp:CommandField ShowEditButton="True" CancelText="Hủy" UpdateText="Cập nhật" EditText="Sửa" />
                    <asp:TemplateField HeaderText="MaNguoiDung" InsertVisible="False" 
                        SortExpression="MaNguoiDung">
                        <EditItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Eval("MaNguoiDung") %>'></asp:Label>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            Mã tài khoản
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("MaNguoiDung") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Deleted" SortExpression="Deleted">
                        <EditItemTemplate>
                            <asp:DropDownList ID="DropDownList2" runat="server" DataValueField="Deleted"
                                SelectedValue='<% # Bind("Deleted") %>'>
                                <asp:ListItem>0</asp:ListItem>
                                <asp:ListItem>1</asp:ListItem>
                            </asp:DropDownList>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            Ðã xóa
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:DropDownList ID="DropDownList1" runat="server" DataValueField="Deleted"
                                SelectedValue='<% # Bind("Deleted") %>' Enabled="false">
                                <asp:ListItem>0</asp:ListItem>
                                <asp:ListItem>1</asp:ListItem>
                            </asp:DropDownList>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="TenNguoiDung" SortExpression="TenNguoiDung">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox1" runat="server" Width="100px"
                            Text='<%# Bind("TenNguoiDung") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            Tên tài khoản
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label2" runat="server" Width="100px"
                             Text='<%# Bind("TenNguoiDung") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="MatKhau" SortExpression="MatKhau">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox2" runat="server" Width="100px"
                             Text='<%# Bind("MatKhau") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            Mật khẩu
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label3" runat="server" Width="100px"
                             Text='<%# Bind("MatKhau") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Email" SortExpression="Email">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox3" runat="server" Width="100px"
                             Text='<%# Bind("Email") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            Email
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label4" runat="server"
                             Text='<%# Bind("Email") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="DienThoai" SortExpression="DienThoai">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox4" runat="server" Width="100px"
                             Text='<%# Bind("DienThoai") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            Điện thoại
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label5" runat="server" Width="100px"
                             Text='<%# Bind("DienThoai") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="DiaChi" SortExpression="DiaChi">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox5" runat="server" Width="100px"
                             Text='<%# Bind("DiaChi") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            Địa chỉ
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label6" runat="server" Width="100px"
                             Text='<%# Bind("DiaChi") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="MaKichHoatTaiKhoan" 
                        SortExpression="MaKichHoatTaiKhoan">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox6" runat="server" Width="50px"
                                Text='<%# Bind("MaKichHoatTaiKhoan") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            Mã kích hoạt Tài Khoản
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label7" runat="server" Text='<%# Bind("MaKichHoatTaiKhoan") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="TinhTrangKichHoatTaiKhoan" 
                        SortExpression="TinhTrangKichHoatTaiKhoan">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox7" runat="server" Width="50px"
                                Text='<%# Bind("TinhTrangKichHoatTaiKhoan") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            Trình trạng Tài Khoản
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label8" runat="server" 
                                Text='<%# Bind("TinhTrangKichHoatTaiKhoan") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="ThoiGianDangKy" SortExpression="ThoiGianDangKy">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox8" runat="server" Width="70px" 
                            Text='<%# Bind("ThoiGianDangKy") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            TGian ĐKý
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label9" runat="server" Text='<%# Bind("ThoiGianDangKy") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="ThoiGianHetHan" SortExpression="ThoiGianHetHan">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox9" runat="server" Width="70px"
                             Text='<%# Bind("ThoiGianHetHan") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            TGian hết hạn
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label10" runat="server" Width="70px"
                             Text='<%# Bind("ThoiGianHetHan") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="TenLoaiNguoiDung" 
                        SortExpression="TenLoaiNguoiDung">
                        <EditItemTemplate>
                            <asp:DropDownList ID="DropDownList4" runat="server" Width="66px"
                                DataSourceID="SqlDataSource1" SelectedValue='<% # Bind("TenLoaiNguoiDung") %>'
                                DataValueField="TenLoaiNguoiDung">
                            </asp:DropDownList>
                            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:RAOVATConnectionString %>" 
                                SelectCommand="SELECT [TenLoaiNguoiDung] FROM [LOAINGUOIDUNG] WHERE ([Deleted] = @Deleted)">
                                <SelectParameters>
                                    <asp:Parameter DefaultValue="0" Name="Deleted" Type="Int32" />
                                </SelectParameters>
                            </asp:SqlDataSource>
                        </EditItemTemplate>
                        <HeaderTemplate>
                            Loại tài khoản
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:DropDownList ID="DropDownList3" runat="server" Enabled="false"
                                DataSourceID="SqlDataSource1"  Width="66px"
                                DataValueField="TenLoaiNguoiDung"  SelectedValue='<% # Bind("TenLoaiNguoiDung") %>'>
                            </asp:DropDownList>
                            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:RAOVATConnectionString %>" 
                                SelectCommand="SELECT [TenLoaiNguoiDung] FROM [LOAINGUOIDUNG]">
                            </asp:SqlDataSource>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
    
             <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                ConnectionString="<%$ ConnectionStrings:RAOVATConnectionString %>" 
                ProviderName="System.Data.SqlClient" 
                SelectCommand="SELECT NGUOIDUNG.MaNguoiDung, NGUOIDUNG.TenNguoiDung, NGUOIDUNG.MatKhau, NGUOIDUNG.Email, NGUOIDUNG.DienThoai, NGUOIDUNG.DiaChi, NGUOIDUNG.MaKichHoatTaiKhoan, NGUOIDUNG.TinhTrangKichHoatTaiKhoan, NGUOIDUNG.ThoiGianDangKy, NGUOIDUNG.ThoiGianHetHan, NGUOIDUNG.Deleted, LOAINGUOIDUNG.TenLoaiNguoiDung FROM NGUOIDUNG INNER JOIN LOAINGUOIDUNG ON NGUOIDUNG.MaLoaiNguoiDung = LOAINGUOIDUNG.MaLoaiNguoiDung INNER JOIN LOAINGUOIDUNG AS LOAINGUOIDUNG_1 ON NGUOIDUNG.MaLoaiNguoiDung = LOAINGUOIDUNG_1.MaLoaiNguoiDung" 
                ></asp:SqlDataSource>
    
             <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                 ConnectionString="<%$ ConnectionStrings:RAOVATConnectionString %>" 
                 
                SelectCommand="SELECT NGUOIDUNG.MaNguoiDung, NGUOIDUNG.TenNguoiDung, NGUOIDUNG.MatKhau, NGUOIDUNG.Email, NGUOIDUNG.DienThoai, NGUOIDUNG.DiaChi, NGUOIDUNG.MaKichHoatTaiKhoan, NGUOIDUNG.TinhTrangKichHoatTaiKhoan, NGUOIDUNG.ThoiGianDangKy, NGUOIDUNG.ThoiGianHetHan, NGUOIDUNG.Deleted, LOAINGUOIDUNG.TenLoaiNguoiDung FROM NGUOIDUNG INNER JOIN LOAINGUOIDUNG ON NGUOIDUNG.MaLoaiNguoiDung = LOAINGUOIDUNG.MaLoaiNguoiDung" 
                ProviderName="System.Data.SqlClient">
             </asp:SqlDataSource>
    
             <asp:LinqDataSource ID="LinqDataSource1" runat="server" 
                 ContextTypeName="DAO.RaoVatDataContext" Select="TenLoaiNguoiDung" 
                 TableName="LOAINGUOIDUNGs" Where="Deleted == @Deleted">
                 <WhereParameters>
                     <asp:Parameter DefaultValue="0" Name="Deleted" Type="Int32" />
                 </WhereParameters>
             </asp:LinqDataSource>
             
             <div style="float:left">
            <asp:Button ID="Button1" runat="server" Text="Thêm người dùng" 
                onclick="Button1_Click" />
            </div>
            </div>
            </div>
            </div>
</asp:Content>
